<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
  <style>

    .box {
  width: 100px;
  height: 100px;
  background-color: #000;
}

.icon-menu {
    display: inline-block;
    width: 140px; height: 10px;
    padding: 35px 0;
    border-top: 10px solid;
    border-bottom: 10px solid;
    background-color: currentColor;
    background-clip: content-box;
}

.icon-dot {
    display: inline-block;
    width: 100px; 
    height: 100px;
    padding: 10px;
    border: 10px solid;    
    border-radius: 50%;
    background-color: currentColor;
    background-clip: content-box;
}
  </style>
</head>

<body>
  <div class="box"></div>
  <button type="button" onclick="loadDoc()">
    Change Content
  </button>
  <div class="demo"></div>
  <i class="icon-menu"></i>
  <i class="icon-dot"></i>
  <i class="icon-menu2"></i>
  <i class="icon-dot2"></i>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pubsub-js/1.6.0/pubsub.js"></script>
  <script>
    console.log($)

    function f1() {
      console.log(1)
      setTimeout(() => {
        PubSub.publish('done')
      }, 1000);
      console.log('done')
    }

    function f2() {
      console.dir(2)
      PubSub.unsubscribe('done', f2)
    }
    PubSub.subscribe('done', f2)
    f1()
  </script>
</body>

</html>